package com.mall.b2c.bean;

import com.mall.b2c.domain.goods.GoodsCategoryDomain;
import com.mall.b2c.domain.goods.GoodsDomain;
import com.mall.b2c.domain.intergral.ShopCartItemDomain;
import com.mall.b2c.domain.intergral.ShopClassDomain;
import com.mall.b2c.domain.intergral.ShopProductDomain;
import com.mall.b2c.domain.order.CartItemDomain;
import com.mall.common.util.UploadUtil;

import java.math.BigDecimal;

public class ShopCartItemBean {
	private Long id;
	private Long goodsId;
	private String productName;
	private String productCode;
	private String spec;
	private String image;
	private String manufacturer;
	private Integer price;
	private Integer quantity;
	private String cateCode;//分类code

	public ShopCartItemBean(ShopCartItemDomain cartItem){
		this.id = cartItem.getId();
		this.quantity = cartItem.getNum();
		ShopProductDomain goods = cartItem.getProduct();
		this.goodsId = goods.getId();
		this.productName = goods.getName();
		this.productCode = "";
		this.spec = goods.getContent();
		this.image = UploadUtil.replacePath(goods.getLitpic());
//		this.manufacturer = goods.getManufacturer();
		this.price = goods.getPrice();
		ShopClassDomain cate = goods.getShopclass();
		this.cateCode = cate.getName();
	}

	public Integer getSubtotal(){
		if(price != null && quantity != null){
			return price*quantity;
		}
		return null;
	}

	public String getCateCode() {
		return cateCode;
	}

	public void setCateCode(String cateCode) {
		this.cateCode = cateCode;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Long getGoodsId() {
		return goodsId;
	}

	public void setGoodsId(Long goodsId) {
		this.goodsId = goodsId;
	}

	public String getProductName() {
		return productName;
	}

	public void setProductName(String productName) {
		this.productName = productName;
	}

	public String getProductCode() {
		return productCode;
	}

	public void setProductCode(String productCode) {
		this.productCode = productCode;
	}

	public String getSpec() {
		return spec;
	}

	public void setSpec(String spec) {
		this.spec = spec;
	}

	public String getImage() {
		return image;
	}

	public void setImage(String image) {
		this.image = image;
	}

	public String getManufacturer() {
		return manufacturer;
	}

	public void setManufacturer(String manufacturer) {
		this.manufacturer = manufacturer;
	}

	public Integer getPrice() {
		return price;
	}

	public void setPrice(Integer price) {
		this.price = price;
	}

	public Integer getQuantity() {
		return quantity;
	}

	public void setQuantity(Integer quantity) {
		this.quantity = quantity;
	}

}
